﻿// 1.1.6.13. Write a program to convert binary numbers to their decimal representation.

using System;

class ConvertBinaryToDecimal
{
    static void Main()
    {
        int userInput = int.Parse(Console.ReadLine());
        int decimalRepresentation = 0;

        for (int i = 0; i < int.MaxValue; i++)
        {
            if (userInput % 10 == 1)
            {
                decimalRepresentation += (int)(Math.Pow(2, i));
                
            }
            userInput /= 10;
            if (userInput == 0)
            {
                break;
            }
        }
        Console.WriteLine(decimalRepresentation);
    }
}
